#include<iostream>
#include<Windows.h>
using namespace std;
int main_getprocessaddress(int argc,char **argv) 
{ 
	typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);

	// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.

	PGNSI pGNSI;
	SYSTEM_INFO si;

	ZeroMemory(&si, sizeof(SYSTEM_INFO));

	pGNSI = (PGNSI) GetProcAddress(
		GetModuleHandle(TEXT("kernel32.dll")), 
		"GetNativeSystemInfo");
	if(NULL != pGNSI)
	{
		pGNSI(&si);
	}
	else 
	{
		GetSystemInfo(&si);
	}

	printf("Hardware information: \n");  
	printf("  OEM ID: %u\n", si.dwOemId);
	printf("  Number of processors: %u\n", 
		si.dwNumberOfProcessors); 
	printf("  Page size: %u\n", si.dwPageSize); 
	printf("  Processor type: %u\n", si.dwProcessorType); 
	printf("  Minimum application address: %lx\n", 
		si.lpMinimumApplicationAddress); 
	printf("  Maximum application address: %lx\n", 
		si.lpMaximumApplicationAddress); 
	printf("  Active processor mask: %u\n", 
		si.dwActiveProcessorMask); 
	return 0; 
} 
